const calcSum = (arr) => {
  if (arr.length == 1) {
    return arr[0];
  } else {
    return arr[0] + calcSum(arr.slice(1));
  }
};

let arr = [1, 3, 5, 7, 9];

console.log(calcSum(arr));
